#include <iostream>
#include <cmath>
#include <string>

#include "conv.cpp"

using namespace std;

void printMenu();
void chooseConv();
string choice;

void getInput();
double input;

double solveAns();
double ans;

void printOutput();

void chooseRestart();


int main()
{
    cout << "=========================================" << endl;
    cout << "  " << "ConvertIt v2.0 BETA" << endl;
    cout << "           " << "by Markus (mafaer@gmail.com)" << endl;
    cout << "=========================================" << endl;
    cout << "\n" << endl;
    
    printMenu();
    chooseConv();
    
    getInput();
    
    printOutput();
    
    chooseRestart();
    
    system("pause");
    return 0;
}


/*                  Functions                           */
void printMenu()
{
     cout << "\t" << "Conversion Menu:" << endl;
     cout << "\t" << "   1. Celsius to Fahrenheit" << endl;
     cout << "\t" << "   2. Fahrenheit to Celsius" << endl;    
}

void chooseConv()
{
     cout << "\t" << "Conversion #: ";
     cin >> choice;
     cout << endl;
}

void getInput()
{
     cout << "Enter number: ";
     cin >> input;
     cout << endl;
}

double solveAns()
{
       if (choice == "1")
       {
          return C2F(input);
       }     
}

void printOutput()
{
     cout << "Equals = " << solveAns() << endl;
     cout << "===============" << endl;
}

void chooseRestart()
{
     string choice2;
     cout << "\n\t" << "New conversion? (y/n) ";
     cin >> choice2;
     cout << endl;
     if (choice2 == "y" || choice2 == "Y")
        {
        chooseConv();
        } else {
           cout << "\nThanks for using ConvertIt.\n" << endl;
                }
}
